﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FortuneHeavenCommon.Enum;
using System.Text;
using FortuneHeaven.Web.Common;

namespace FortuneHeaven.Web.Controls
{
    public partial class Header : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (SelectTab == MainPageTabType.hidden)
            {
                ulShow.Visible = false;
            }

        }

        public string GetTitle()
        {

            StringBuilder builder = new StringBuilder();
            if (this.Visible)
            {
                string[] total = { "首页", "新闻", "下载", "充值", "游戏商城", "奖品中心", "免费抽奖" };
                string[] link = { BasePath.MainPage, BasePath.News, BasePath.Download, BasePath.Charge, BasePath.Shop, BasePath.Gift, BasePath.Lottery };
                for (int i = 0; i < total.Length; i++)
                {
                    if (i != (int)SelectTab)
                    {
                        builder.Append(string.Format("<a href=\"{0}\">{1}</a>", link[i], total[i]));
                    }
                    else
                    {
                        builder.Append(string.Format("<a href=\"{0}\" class=\"sy\" >{1}</a>", link[i], total[i]));
                    }
                }
            }
            return builder.ToString();

        }

        public MainPageTabType SelectTab
        {
            get
            {
                object obj = ViewState["SelectTab"];
                if (obj == null)
                {
                    return MainPageTabType.mainpage;
                }
                return (MainPageTabType)obj;
            }
            set
            {
                ViewState["SelectTab"] = value;
            }
        }
    }
}